package com.axxc.jpa.entity;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonBackReference;

@Entity
@Table(name = "t_teacher")
public class TeacherEntity extends PersonEntity {

	private static final long serialVersionUID = 1L;
	@ManyToMany(/*cascade = CascadeType.ALL,*/ fetch = FetchType.LAZY, mappedBy = "teachers")
	@JSONField(serialize=false)
	@JsonBackReference // 解决序列化死循环
	private List<StudentEntity> students = new ArrayList<>();

	public List<StudentEntity> getStudents() {
		return students;
	}

	public void setStudents(List<StudentEntity> students) {
		this.students = students;
	}


}
